﻿using System;
using System.Collections.Generic;

namespace MyLib {
	/// <summary>
	/// 
	/// </summary>
	public class ParameterDictionary : IEnumerable<KeyValuePair<string, object>> {
		/// <summary>
		/// 
		/// </summary>
		private IDictionary<string, object> m_innerDictionary;

		/// <summary>
		/// 
		/// </summary>
		public int Count {
			get {
				return m_innerDictionary.Count;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public void Clear() {
			m_innerDictionary.Clear();
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="parameterName"></param>
		/// <returns></returns>
		public bool Contains(string parameterName) {
			return m_innerDictionary.ContainsKey(parameterName);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="parameterName"></param>
		/// <returns></returns>
		public object this[string parameterName] {
			get {
				if (m_innerDictionary.ContainsKey(parameterName))
					return m_innerDictionary[parameterName];
				else
					return null;
			}
			set {
				m_innerDictionary[parameterName] = value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public ParameterDictionary() {
			m_innerDictionary = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public IEnumerator<KeyValuePair<string, object>> GetEnumerator() {
			return m_innerDictionary.GetEnumerator();
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
			return this.GetEnumerator();
		}
	} // end of ParameterDictionary.
}
